import { IPSModelSortable } from '../../ipsmodel-sortable';
import { IPSDEWizard } from './ipsdewizard';
import { IPSDEWizardForm } from './ipsdewizard-form';
import { IPSDEWizardStep } from './ipsdewizard-step';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEWizardImpl extends PSModelObjectImpl implements IPSDEWizard, IPSModelSortable {
  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get extendMode(): 0 | 2 {
    return this.M.extendMode != null ? this.M.extendMode : 0;
  }

  get finishCapLanResTag(): string {
    return this.M.finishCapLanResTag;
  }

  protected finishcappslanguageres: IPSLanguageRes | null = null;

  getFinishCapPSLanguageRes(): IPSLanguageRes | null {
    if (this.finishcappslanguageres != null) return this.finishcappslanguageres;
    const value = this.M.getFinishCapPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.finishcappslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getFinishCapPSLanguageRes') as IPSLanguageRes;
    return this.finishcappslanguageres;
  }

  get finishCapPSLanguageRes(): IPSLanguageRes | null {
    return this.getFinishCapPSLanguageRes();
  }

  getFinishCapPSLanguageResMust(): IPSLanguageRes {
    const value = this.getFinishCapPSLanguageRes();
    if (value == null) {
      throw new Error('未指定完成标题语言资源');
    }
    return value;
  }

  get finishCaption(): string {
    return this.M.finishCaption;
  }

  protected firstpsdewizardform: IPSDEWizardForm | null = null;

  getFirstPSDEWizardForm(): IPSDEWizardForm | null {
    if (this.firstpsdewizardform != null) return this.firstpsdewizardform;
    const value = this.M.getFirstPSDEWizardForm;
    if (value == null) {
      return null;
    }
    this.firstpsdewizardform = this.getPSModel4('dataentity.wizard.IPSDEWizardForm', value, 'getFirstPSDEWizardForm') as IPSDEWizardForm;
    return this.firstpsdewizardform;
  }

  get firstPSDEWizardForm(): IPSDEWizardForm | null {
    return this.getFirstPSDEWizardForm();
  }

  getFirstPSDEWizardFormMust(): IPSDEWizardForm {
    const value = this.getFirstPSDEWizardForm();
    if (value == null) {
      throw new Error('未指定首向导表单');
    }
    return value;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  get nextCapLanResTag(): string {
    return this.M.nextCapLanResTag;
  }

  protected nextcappslanguageres: IPSLanguageRes | null = null;

  getNextCapPSLanguageRes(): IPSLanguageRes | null {
    if (this.nextcappslanguageres != null) return this.nextcappslanguageres;
    const value = this.M.getNextCapPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.nextcappslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getNextCapPSLanguageRes') as IPSLanguageRes;
    return this.nextcappslanguageres;
  }

  get nextCapPSLanguageRes(): IPSLanguageRes | null {
    return this.getNextCapPSLanguageRes();
  }

  getNextCapPSLanguageResMust(): IPSLanguageRes {
    const value = this.getNextCapPSLanguageRes();
    if (value == null) {
      throw new Error('未指定下一步标题语言资源');
    }
    return value;
  }

  get nextCaption(): string {
    return this.M.nextCaption;
  }

  get orderValue(): number {
    return this.M.orderValue != null ? this.M.orderValue : 99999;
  }

  protected psdewizardforms: IPSDEWizardForm[] | null = null;

  getPSDEWizardForms(): IPSDEWizardForm[] | null {
    if (this.psdewizardforms == null) {
      this.psdewizardforms = this.fillChildListModel(this.M.getPSDEWizardForms, 'dataentity.wizard.IPSDEWizardForm') as IPSDEWizardForm[];
    }
    return this.psdewizardforms;
  }

  get psDEWizardForms(): IPSDEWizardForm[] | null {
    return this.getPSDEWizardForms();
  }

  findPSDEWizardForm(objKey: any): IPSDEWizardForm | null {
    return this.getPSModel5('dataentity.wizard.IPSDEWizardForm', this.getPSDEWizardForms(), objKey) as IPSDEWizardForm;
  }

  protected psdewizardsteps: IPSDEWizardStep[] | null = null;

  getPSDEWizardSteps(): IPSDEWizardStep[] | null {
    if (this.psdewizardsteps == null) {
      this.psdewizardsteps = this.fillChildListModel(this.M.getPSDEWizardSteps, 'dataentity.wizard.IPSDEWizardStep') as IPSDEWizardStep[];
    }
    return this.psdewizardsteps;
  }

  get psDEWizardSteps(): IPSDEWizardStep[] | null {
    return this.getPSDEWizardSteps();
  }

  findPSDEWizardStep(objKey: any): IPSDEWizardStep | null {
    return this.getPSModel5('dataentity.wizard.IPSDEWizardStep', this.getPSDEWizardSteps(), objKey) as IPSDEWizardStep;
  }

  get prevCapLanResTag(): string {
    return this.M.prevCapLanResTag;
  }

  protected prevcappslanguageres: IPSLanguageRes | null = null;

  getPrevCapPSLanguageRes(): IPSLanguageRes | null {
    if (this.prevcappslanguageres != null) return this.prevcappslanguageres;
    const value = this.M.getPrevCapPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.prevcappslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getPrevCapPSLanguageRes') as IPSLanguageRes;
    return this.prevcappslanguageres;
  }

  get prevCapPSLanguageRes(): IPSLanguageRes | null {
    return this.getPrevCapPSLanguageRes();
  }

  getPrevCapPSLanguageResMust(): IPSLanguageRes {
    const value = this.getPrevCapPSLanguageRes();
    if (value == null) {
      throw new Error('未指定上一步标题语言资源');
    }
    return value;
  }

  get prevCaption(): string {
    return this.M.prevCaption;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get wizardStyle(): 'DEFAULT' | 'STYLE2' | 'STYLE3' | 'STYLE4' {
    return this.M.wizardStyle;
  }

  get enableMainStateLogic(): boolean {
    return this.M.enableMainStateLogic != null ? this.M.enableMainStateLogic : false;
  }

  get stateWizard(): boolean {
    return this.M.stateWizard;
  }

  get cls(): string {
    return 'PSDEWizardImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'IPSModelSortable' || cls == 'dataentity.wizard.IPSDEWizard') return true;
    return super.instanceof(cls);
  }
}
